package com.ytf.test.fourth;

import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;

/**
 * @author: YTF
 * @date: 2024/9/15 15:02
 * @version: 1.0
 * @description: 吸血鬼数字
 */
public class VampireNumber {
    public static void main(String[] args) {
        for (int i = 10; i < 100; i++) {
            for (int j = 10; j < 100 ; j++) {
                test(i, j);
            }
        }
        // test(21,60);
    }

    private static void test(int i, int j) {
        String str =""+i+j;
        Integer number = i * j;
        if (number<1000 || number>10000){
            // System.out.println("小于一千大于1万之间返回");
            return;
        }
        if (number%100 == 0){
            // System.out.println("结尾两个零，不满足条件");
            return;
        }
        List list = new ArrayList();
        String s = String.valueOf(number);
        for (int k = 0; k < s.length(); k++) {
            list.add(s.charAt(k));
        }
        char[] chars = str.toCharArray();
        for (char c :chars) {
            int i1 = list.indexOf(c);
            if ( i1==-1){
                return;
            }
            list.remove(i1);
        }
        System.out.println(number+"="+ i +"*"+ j);
    }

}
